home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 April / 1992-04.d64 / the cube (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  126 lines

  1. 0 clr
  2. 10 rem copyright 1992 - compute publications intl ltd - all rights reserved
  3. 60 print"[147]":poke53281,1:poke53280,1
  4. 70 r=0:print"        the cube "
  5. 80 a=1138:b=55410:fork=1to4:readg:fort=1to4:poke a,160:pokeb,g:a=a+1:b=b+1
  6. 90 nextt:a=a+36:b=b+36:nextk:poke1141,32
  7. 100 dim a1(16):b1=1:tr=0
  8. 210 r=r+1:k=int(rnd(0)*16+1):if a1(k)=0then t=t:    readl:a1(k)=l:goto230
  9. 220 r=r-1:goto210
  10. 230 if r<>16then210
  11. 235 a=1105:c=55377:z=1
  12. 240 form=z toz+3 :b=a:d=c
  13. 250 fork=1 to4:fort=1 to6:poked,a1(m):pokeb,160:b=b+1:d=d+1
  14. 260 next t:b=b+34:d=d+34:next k:a=a+7 :c=c+ 7:next m:a=b+19:c=d+19
  15. 270 ifb>1690thenprint"[145][145][145]":goto300
  16. 280 z=z+4:goto240
  17. 300 v=53248:poke2040,13:fors=832to832+62:readg:pokes,g:next
  18. 310 pokev+21,1:pokev+39,15:pokev,32:pokev+1,60 :pokev+23,1:pokev+29,1:x=32:y=60
  19. 320 get a$:if a$="[145]"and y>=100then y=y-40:pokev+1,y:b1=b1-4: goto320
  20. 330 if a$=""and y<=140then y=y+40:pokev+1,y:b1=b1+4: goto320
  21. 340 if a$=""and x<=144then x=x+56:pokev  ,x:b1=b1+1: goto320
  22. 350 if a$="[157]"and x>=88 then x=x-56:pokev  ,x:b1=b1-1:goto320
  23. 360 if a$="[133]" then 400
  24. 370 if a$="[136]" then 760
  25. 380 goto320
  26. 400 forg=1to16:if a1(g)=1then 420
  27. 410 next
  28. 420 on g goto 430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580
  29. 430 if b1=2 or b1=5 then600
  30. 435 goto320
  31. 440 if b1=1 or b1=3 or b1=6 then600
  32. 445 goto320
  33. 450 if b1=2 or b1=4 or b1=7 then600
  34. 455 goto320
  35. 460 if b1=3 orb1=8 then600
  36. 465 goto320
  37. 470 if b1=1 orb1=6 orb1=9 then610
  38. 475 goto320
  39. 480 if b1=5 orb1=2 orb1=7orb1=10then610
  40. 485 goto320
  41. 490 if b1=6 orb1=3 orb1=8orb1=11then610
  42. 495 goto320
  43. 500 if b1=7orb1=4 orb1=12then610
  44. 505 goto320
  45. 510 if b1=5 orb1=10orb1=13then620
  46. 515 goto320
  47. 520 if b1=9 orb1=6orb1=11orb1=14then620
  48. 525 goto320
  49. 530 if b1=10orb1=7orb1=12orb1=15then620
  50. 535 goto320
  51. 540 if b1=11orb1=8 orb1=16then620
  52. 545 goto320
  53. 550 if b1=9 orb1=14then630
  54. 555 goto320
  55. 560 if b1=13orb1=10orb1=15then630
  56. 565 goto320
  57. 570 if b1=14orb1=11orb1=16then630
  58. 575 goto320
  59. 580 if b1=15orb1=12then630
  60. 585 goto320
  61. 600 if g=1 then b=1105:d=55377:goto 640
  62. 601 if g=2 then b=1112:d=55384:goto 640
  63. 602 if g=3 then b=1119:d=55391:goto 640
  64. 603 if g=4 then b=1126:d=55398:goto 640
  65. 610 if g=5 then b=1305:d=55577:goto 640
  66. 611 if g=6 then b=1312:d=55584:goto 640
  67. 612 if g=7 then b=1319:d=55591:goto 640
  68. 613 if g=8 then b=1326:d=55598:goto 640
  69. 620 if g=9 then b=1505:d=55777:goto 640
  70. 621 if g=10then b=1512:d=55784:goto 640
  71. 622 if g=11then b=1519:d=55791:goto 640
  72. 623 if g=12then b=1526:d=55798:goto 640
  73. 630 if g=13then b=1705:d=55977:goto 640
  74. 631 if g=14then b=1712:d=55984:goto 640
  75. 632 if g=15then b=1719:d=55991:goto 640
  76. 633 if g=16then b=1726:d=55998:goto 640
  77. 635 goto 320
  78. 640 j=0:tr=tr+1
  79. 650 j=j+1:fort=1 to6:poked,a1(b1):pokeb,160:b=b+1:d=d+1:nextt
  80. 660 b=b+34:d=d+34:if j>3then 670
  81. 661 goto650
  82. 670 ifb1=1 then b=1105:d=55377:goto 710
  83. 671 ifb1=2 then b=1112:d=55384:goto 710
  84. 672 ifb1=3 then b=1119:d=55391:goto 710
  85. 673 ifb1=4 then b=1126:d=55398:goto 710
  86. 680 ifb1=5 then b=1305:d=55577:goto 710
  87. 681 ifb1=6 then b=1312:d=55584:goto 710
  88. 682 ifb1=7 then b=1319:d=55591:goto 710
  89. 683 ifb1=8 then b=1326:d=55598:goto 710
  90. 690 ifb1=9 then b=1505:d=55777:goto 710
  91. 691 ifb1=10then b=1512:d=55784:goto 710
  92. 692 ifb1=11then b=1519:d=55791:goto 710
  93. 693 ifb1=12then b=1526:d=55798:goto 710
  94. 700 ifb1=13then b=1705:d=55977:goto 710
  95. 701 ifb1=14then b=1712:d=55984:goto 710
  96. 702 ifb1=15then b=1719:d=55991:goto 710
  97. 703 ifb1=16then b=1726:d=55998:goto 710
  98. 705 goto 320
  99. 710 j=0
  100. 720 j=j+1:fort=1 to6:poked,a1(g ):pokeb,160:b=b+1:d=d+1:nextt
  101. 730 b=b+34:d=d+34:if j>3then 750
  102. 740 goto720
  103. 750 a1(0)=a1(b1):a1(b1)=a1(g):a1(g)=a1(0):g=b1:goto320
  104. 760 r=0:if a1(1)=0 and a1(2)=0 and a1(3)=0 then r=r+1
  105. 770 if a1(5)=2 and a1(6)=2 and a1(7)=2 and a1(8)=2 then r=r+1
  106. 780 if a1(9)=6 and a1(10)=6 and a1(11)=6 and a1(12)=6 then r=r+1
  107. 790 if a1(13)=5 and a1(14)=5 and a1(15)=5 and a1(16)= 5  then r=r+1
  108. 800 if r=4 then print"congratulations it only took you";
  109. 810 if r=4 then print tr;"times to solve the puzzle":end
  110. 820 print" keep trying":fort=1 to 30
  111. 830 poke209,0:poke210,212:poke211,0:print"0d h[213][190] [184][146]@@@@@@@_u@[192]@@@@@o";
  112. 840 n=54296:next:poken,0:print"            ":goto320
  113. 850 rem *****************
  114. 860 rem "" = right movement
  115. 870 rem "[157]" = left movement
  116. 880 rem "[145]" = upward movement
  117. 890 rem "" = downward movement
  118. 900 rem "[133]" = switches the blocks
  119. 910 rem "[136]" = checks to see if puzzle is solved
  120. 920 rem program written by michael pope
  121. 930 rem *****************
  122. 1000 data 0,2,6,5,0,0,0,1,2,2,2,2,6,6,6,6,5,5,5,5,0,0,0,255,255,255
  123. 1010 data 255,255,255,192,0,3,192,0,3,192,0,3,192,0,3,192,0,3,192,0,3,192,0,3
  124. 1020 data 192,0,3,192,0,3,192,0,3,192,0,3,192,0,3,192,0,3,192,0,3,192,0,3
  125. 1030 data 192,0,3,255,255,255,255,255,255
  126.